﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ExamSystem.BLL;
using ExamSystem.Mdeol;
namespace ExamSystem.ht
{
    public partial class TClass_Edit : System.Web.UI.Page
    {
        private TclassBLL tb = new TclassBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!Page.IsPostBack)
            {
                int tcid =int.Parse(Request.QueryString["id"]);
                Tclass t = tb.selecttcid(tcid);
                if (t != null)
                {
                    this.tcNo.Value = t.TcNo;
                }
                
            }
            
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            //获取数据
            string tcno = this.tcNo.Value;
            int tcid = int.Parse(Request.QueryString["id"]); 
            //验证
            if (string.IsNullOrEmpty(tcno))
            {
                util.FunHelper.LayerAlter(this, "班级名称不能为空");
            }
            Tclass t = new Tclass(tcid,tcno);
            int b = tb.update(t);
            if (b > 0)
            {
                util.FunHelper.LayerAlter(this, "修改成功", "TClass_List.aspx");
            }
            else
            {
                util.FunHelper.LayerAlter(this, "修改失败");
            }
            

        }
        protected void onclick(object sender, EventArgs e)
        {
            util.FunHelper.LayerAlter(this, "确定返回吗？", "TClass_List.aspx");
        }
    }
}